Dart allows to use type names as parameter names of functions and methods.
This can be misleading, as the developer may think that the parameter is of the type corresponding to the specified name, but that is not the
case.
A scenario leading to this issue is, for example, when the developer forgets to give a name to the parameter, or assumes that omitting the name and
only specifying the type would be enough to make the parameter of that type (as in C++). That is not the case, as the parameter would be of type
dynamic
.
void foo(int) { // int is a dynamic parameter, not an integer one
print(int);
}
Dart also allows to use a type name both as type and as a name in the same declaration, which can be additional source of confusion:
void foo(int int) { // the type may later change, but the name would remain int
print(int);
}